package com.east.controller;

import com.east.dto.ActivityDTO;
import com.east.dto.ActivityRemarkDTO;
import com.east.result.Result;
import com.east.service.ActivityRemarkService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/activityRemark/")
public class ActivityRemarkController {
    @Resource
    private ActivityRemarkService activityRemarkService;

    @PostMapping("add")
    public Result add(@RequestBody ActivityRemarkDTO activityRemarkDTO) {
        System.out.println(activityRemarkDTO);
        return activityRemarkService.add(activityRemarkDTO);
    }

    @GetMapping("list")
    public Result list(@RequestParam(value = "currentPage", defaultValue = "1", required = false) Integer currentPage,
                       @RequestParam(value = "pageSize", defaultValue = "2", required = false) Integer pageSize,
                       @RequestParam(value = "activityId") Integer activityId) {
        return activityRemarkService.list(currentPage, pageSize, activityId);
    }

    @GetMapping("info")
    public Result info(@RequestParam(value = "remarkId") Integer remarkId) {
        return activityRemarkService.info(remarkId);
    }

    @PutMapping("update")
    public Result update(@RequestBody ActivityRemarkDTO activityRemarkDTO) {
        return activityRemarkService.update(activityRemarkDTO);
    }

    @DeleteMapping("delete")
    public Result delete(@RequestParam("id") Integer id) {
        return activityRemarkService.delete(id);
    }
}
